package com.allen.module_userinfo

import com.alibaba.android.arouter.facade.annotation.Route
import com.allen.common.BaseAct
import com.allen.common.http.MyJasionParser
import com.allen.module_userinfo.databinding.ModuleUserActBinding
import com.tencent.bugly.crashreport.biz.UserInfoBean
import com.yanzhenjie.nohttp.NoHttp
import com.yanzhenjie.nohttp.rest.OnResponseListener
import com.yanzhenjie.nohttp.rest.Request
import com.yanzhenjie.nohttp.rest.Response
import com.zhouwei.mzbanner.holder.MZHolderCreator


/**
 *  @Autor  lwl
 *  日期    2021/4/1
 *  目的
 */
@Route(path=Const.USERINFO_INDEX)
class ModuleUserInfoAct : BaseAct<ModuleUserActBinding, ModuleUserVm>() {

    var mzHolderCreator: MZHolderCreator<ModuleWorkBannerViewHolder> = MZHolderCreator<ModuleWorkBannerViewHolder> { ModuleWorkBannerViewHolder() }
    override fun getResId(): Int {
        return R.layout.module_user_act
    }

    override fun initData() {
    }

    override fun initView() {
    }

    override fun initObserve() {
    }

    override fun bindingVM() {
    }

    override fun getBaseViewModelClass(): Class<ModuleUserVm> {
        return ModuleUserVm::class.java
    }
    public fun getData(){
        val url = "http://47.107.64.240:8120/app/monitorPoint/getAllMonitorPointList"

        val request: Request<UserInfoBean> = MyJasionParser<UserInfoBean>(url, UserInfoBean::class.java)
        request.addHeader(
            "Authorization",
            "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6MSwiZXhwIjoxNjE4MTk1MzYzLCJ1c2VybmFtZSI6ImFkbWluIn0.4UWWl_t6NqFmlIBb6dVKH5t4YlWotqFXHH-1WMKz0Q8"
        )

        val requestQueue = NoHttp.newRequestQueue()
        requestQueue.add(0, request, object : OnResponseListener<UserInfoBean?> {
            override fun onStart(what: Int) {}
            override fun onSucceed(what: Int, response: Response<UserInfoBean?>?) {}
            override fun onFailed(what: Int, response: Response<UserInfoBean?>?) {}
            override fun onFinish(what: Int) {}
        })


    }

    override fun initEvent() {
    }
}